package com.js.springbootmongodb.controller;

import com.js.springbootmongodb.entity.Comment;
import com.js.springbootmongodb.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CommentController {
    @Autowired
    private CommentService commentService;

    @GetMapping("/selectAll")
    public List<Comment> selectAll(){
        List<Comment> list = commentService.selectAll();
        return list;
    }

    @PostMapping("/add")
    public boolean add(Comment comment){
        commentService.add(comment);
        return true;
    }


}
